package cn.tedu.front.search.dao.persist.repository.impl;

import cn.tedu.common.pojo.vo.PageData;
import cn.tedu.common.util.PageInfoToPageDataConverter;
import cn.tedu.front.search.dao.persist.mapper.JobMapper;
import cn.tedu.front.search.dao.persist.repository.IJobRepository;
import cn.tedu.front.search.pojo.po.JobSimplePO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class JobRepository implements IJobRepository {
    @Autowired
    private JobMapper mapper;
    @Override
    public PageData<JobSimplePO> listSearchJob(Integer pageNum, Integer pageSize) {
        //PageData 使用pageNum从第一页开始
        PageHelper.startPage(pageNum,pageSize);
        List<JobSimplePO> jobList = mapper.listSearch();
        PageInfo<JobSimplePO> pageInfo=new PageInfo<>(jobList);
        return PageInfoToPageDataConverter.convert(pageInfo);
    }
}
